﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UnrealConverterLogic;

namespace Ratios
{
    public partial class formRatios : Form
    {
        public formRatios()
        {
            InitializeComponent();
            UnrealConverter.AddFormReference(this);
            this.Location = new Point
            (
                UnrealConverter.formMainPosition.X + UnrealConverter.formMainSize.Width - this.Size.Width,
                UnrealConverter.formMainPosition.Y + UnrealConverter.formMainSize.Height + 10
            );
            this.FormClosed += new FormClosedEventHandler
            (
                delegate(object o, FormClosedEventArgs e)
                {
                    UnrealConverter.bFormRatiosOpen = false;
                }
            );
            
            cbRatios.TextChanged += UnrealConverter.OncbRatioTextChanged;
            cbRatios.SelectedIndex = 0;
            UnrealConverter.InitRatioComboBox();
            UnrealConverter.InitRatioInputs();
            UnrealConverter.UpdateScaleIncrease();
        }

        private void formRatios_Load(object sender, EventArgs e)
        {
            UnrealConverter.AddFormReference(this);
            this.FormClosed += new FormClosedEventHandler
                (
                    delegate(object o, FormClosedEventArgs fe)
                    {
                        UnrealConverter.bFormRatiosOpen = false;
                    }
                );
            tbUURatio.TextChanged += UnrealConverter.OnRatioFieldChangedEventHandler;
            tbMaxRatio.TextChanged += UnrealConverter.OnRatioFieldChangedEventHandler;
            tbMeterRatio.TextChanged += UnrealConverter.OnRatioFieldChangedEventHandler;
            tbProject.TextChanged += UnrealConverter.OnRatioFieldChangedEventHandler;
            btnAddSetToDropDown.Click += UnrealConverter.OnbtnAddSetToDropDown_Click;
            btnRemoveSetFromDropDown.Click += UnrealConverter.OnbtnRemoveSetFromDropDown_Click;
            cbRatios.TextChanged += UnrealConverter.OncbRatioTextChanged;
        }
    }
}
